import $http from '@/apis/http'
export default {
    namespaced: true,
    state: {
        array: [],
    },

    mutations: {
        renderRoleData(state, val) {
            state.array = val
        },
    },
    actions: {
        async fetchDataUT(context, val) {
            let { data: res } = await $http.role.findRole()
            context.commit('renderRoleData', res.data)
        },
        async deleteRoleData(context, val) {
            let { data: res } = await $http.role.delRole({ _id: val })
            if (res.meta.status == 200) {
                context.dispatch('fetchDataUT')
            }
            
        }
    }
}